

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>7.4. Compute observable timeseries from trajectories — MDAnalysis.core.Timeseries &mdash; MDAnalysis v0.7.5-devel documentation</title>
    <link rel="stylesheet" href="../../_static/sphinxdoc.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.7.5-devel',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within MDAnalysis v0.7.5-devel documentation"
          href="../../_static/opensearch.xml"/>
    <link rel="shortcut icon" href="../../_static/mdanalysis-logo.ico"/>
    <link rel="top" title="MDAnalysis v0.7.5-devel documentation" href="../../index.html" />
    <link rel="up" title="7. Core modules" href="../core_modules.html" />
    <link rel="next" title="7.5. Fast distance array computation — MDAnalysis.core.distances" href="distances.html" />
    <link rel="prev" title="7.3. Atom selection Hierarchy — MDAnalysis.core.Selection" href="Selection.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="distances.html" title="7.5. Fast distance array computation — MDAnalysis.core.distances"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="Selection.html" title="7.3. Atom selection Hierarchy — MDAnalysis.core.Selection"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../core_modules.html" accesskey="U">7. Core modules</a> &raquo;</li> 
      </ul>
    </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/mdanalysis-logo-200x150.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">7.4. Compute observable timeseries from trajectories &#8212; <tt class="docutils literal"><span class="pre">MDAnalysis.core.Timeseries</span></tt></a><ul>
<li><a class="reference internal" href="#basic-classes">7.4.1. Basic classes</a></li>
<li><a class="reference internal" href="#timeseries-of-observables">7.4.2. Timeseries of observables</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="Selection.html"
                        title="previous chapter">7.3. Atom selection Hierarchy &#8212; <tt class="docutils literal docutils literal docutils literal"><span class="pre">MDAnalysis.core.Selection</span></tt></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="distances.html"
                        title="next chapter">7.5. Fast distance array computation &#8212; <tt class="docutils literal"><span class="pre">MDAnalysis.core.distances</span></tt></a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/documentation_pages/core/Timeseries.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="module-MDAnalysis.core.Timeseries"></span><div class="section" id="compute-observable-timeseries-from-trajectories-mdanalysis-core-timeseries">
<h1>7.4. Compute observable timeseries from trajectories &#8212; <a class="reference internal" href="#module-MDAnalysis.core.Timeseries" title="MDAnalysis.core.Timeseries"><tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.core.Timeseries</span></tt></a><a class="headerlink" href="#compute-observable-timeseries-from-trajectories-mdanalysis-core-timeseries" title="Permalink to this headline">¶</a></h1>
<p>The collection of timeseries (such as <a class="reference internal" href="#MDAnalysis.core.Timeseries.Atom" title="MDAnalysis.core.Timeseries.Atom"><tt class="xref py py-class docutils literal"><span class="pre">Atom</span></tt></a>, <a class="reference internal" href="#MDAnalysis.core.Timeseries.Bond" title="MDAnalysis.core.Timeseries.Bond"><tt class="xref py py-class docutils literal"><span class="pre">Bond</span></tt></a>,
<a class="reference internal" href="#MDAnalysis.core.Timeseries.Dihedral" title="MDAnalysis.core.Timeseries.Dihedral"><tt class="xref py py-class docutils literal"><span class="pre">Dihedral</span></tt></a>...)  can be computed from a trajectory in one go, foregoing
the need to iterate through the trajectory frame by frame in python. Inspired
by CHARMM&#8217;s correl command.</p>
<p>The disadvantage is that the timeseries &#8216;plugins&#8217; must be implemented
in C-code. Hence not all trajectory readers (see <tt class="xref py py-mod docutils literal"><span class="pre">MDAnalysis.coordinates</span></tt>)
support them.</p>
<div class="section" id="basic-classes">
<h2>7.4.1. Basic classes<a class="headerlink" href="#basic-classes" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="MDAnalysis.core.Timeseries.Timeseries">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">Timeseries</tt><big>(</big><em>code</em>, <em>atoms</em>, <em>dsize</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.Timeseries" title="Permalink to this definition">¶</a></dt>
<dd><p>Base timeseries class - define subclasses for specific timeseries computations</p>
<dl class="attribute">
<dt id="MDAnalysis.core.Timeseries.Timeseries.shape">
<tt class="descname">shape</tt><a class="headerlink" href="#MDAnalysis.core.Timeseries.Timeseries.shape" title="Permalink to this definition">¶</a></dt>
<dd><p>shape tuple of the underlying numpy array</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.TimeseriesCollection">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">TimeseriesCollection</tt><a class="headerlink" href="#MDAnalysis.core.Timeseries.TimeseriesCollection" title="Permalink to this definition">¶</a></dt>
<dd><p>A collection of timeseries objects.</p>
<p>The collection of timeseries (such as Atom, Bond, Dihedral...)  can be
computed from a trajectory in one go, foregoing the need to iterate through
the trajectory frame by frame in python. Inspired by CHARMM&#8217;s correl
command.</p>
<p>The disadvantage is that the timeseries &#8216;plugins&#8217; must be implemented in
C-code.</p>
<div class="highlight-python"><pre>collection = TimeseriesCollection()
collection.addTimeseries(Timeseries.Atom(...)) - add a new Timeseries object
collection.compute(...)                        - compute the collection of timeseries from the trajectory
collection.clear()                             - clear the collection
collection[i]                                  - access the i'th timeseries
len(collection)                                - return the number of Timeseries added to the collection</pre>
</div>
<dl class="method">
<dt id="MDAnalysis.core.Timeseries.TimeseriesCollection.addTimeseries">
<tt class="descname">addTimeseries</tt><big>(</big><em>ts</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.TimeseriesCollection.addTimeseries" title="Permalink to this definition">¶</a></dt>
<dd><p>add a Timeseries object to the collection</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.core.Timeseries.TimeseriesCollection.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.TimeseriesCollection.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>clear the timeseries collection</p>
</dd></dl>

<dl class="method">
<dt id="MDAnalysis.core.Timeseries.TimeseriesCollection.compute">
<tt class="descname">compute</tt><big>(</big><em>trj</em>, <em>start=0</em>, <em>stop=-1</em>, <em>skip=1</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.TimeseriesCollection.compute" title="Permalink to this definition">¶</a></dt>
<dd><p>trj - dcd trajectory object (ie universe.dcd)
start, stop, skip and self explanatory, although it is important to note that
start and stop are inclusive</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="timeseries-of-observables">
<h2>7.4.2. Timeseries of observables<a class="headerlink" href="#timeseries-of-observables" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="MDAnalysis.core.Timeseries.Atom">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">Atom</tt><big>(</big><em>code</em>, <em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.Atom" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a timeseries that returns coordinate data for an atom or group of atoms</p>
<blockquote>
<div>t = Atom(code, atoms)</div></blockquote>
<p>code is one of &#8216;x&#8217;, &#8216;y&#8217;, &#8216;z&#8217;, or &#8216;v&#8217; (&#8216;vector&#8217;, which returns all three dimensions)
atoms can be a single Atom object, a list of Atom objects, or an AtomGroup</p>
</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.Bond">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">Bond</tt><big>(</big><em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.Bond" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a timeseries that returns a timeseries for a bond</p>
<blockquote>
<div>t = Bond(atoms)</div></blockquote>
<p>atoms must contain 2 Atoms, either as a list or an AtomGroup</p>
</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.Angle">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">Angle</tt><big>(</big><em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.Angle" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a timeseries that returns a timeseries for an angle</p>
<blockquote>
<div>t = Angle(atoms)</div></blockquote>
<p>atoms must contain 3 Atoms, either as a list or an AtomGroup</p>
</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.Dihedral">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">Dihedral</tt><big>(</big><em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.Dihedral" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a timeseries that returns a timeseries for a dihedral angle</p>
<blockquote>
<div>t = Dihedral(atoms)</div></blockquote>
<p>atoms must contain 4 Atoms, either as a list or an AtomGroup</p>
</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.Distance">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">Distance</tt><big>(</big><em>code</em>, <em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.Distance" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a timeseries that returns distances between 2 atoms</p>
<blockquote>
<div>t = Distance(code, atoms)</div></blockquote>
<p>code is one of &#8216;d&#8217; (distance vector), or &#8216;r&#8217; (scalar distance)
atoms must contain 2 Atoms, either as a list or an AtomGroup</p>
</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.CenterOfGeometry">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">CenterOfGeometry</tt><big>(</big><em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.CenterOfGeometry" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a timeseries that returns the center of geometry of a group of atoms</p>
<blockquote>
<div>t = CenterOfGeometry(atoms)</div></blockquote>
<p>atoms can be a list of Atom objects, or an AtomGroup</p>
</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.CenterOfMass">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">CenterOfMass</tt><big>(</big><em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.CenterOfMass" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a timeseries that returns the center of mass of a group of atoms</p>
<blockquote>
<div>t = CenterOfMass(atoms)</div></blockquote>
<p>atoms can be a list of Atom objects, or an AtomGroup</p>
</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.PrincipleAxis">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">PrincipleAxis</tt><big>(</big><em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.PrincipleAxis" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a timeseries that returns the principle axis for a group of atoms</p>
<blockquote>
<div>t = principleAxis(atoms)</div></blockquote>
<p>atoms can be a list of Atom objects, or an AtomGroup</p>
</dd></dl>

<dl class="class">
<dt id="MDAnalysis.core.Timeseries.WaterDipole">
<em class="property">class </em><tt class="descclassname">MDAnalysis.core.Timeseries.</tt><tt class="descname">WaterDipole</tt><big>(</big><em>atoms</em><big>)</big><a class="headerlink" href="#MDAnalysis.core.Timeseries.WaterDipole" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Timeseries that returns a timeseries for the dipole vector of a 3-site water</p>
<blockquote>
<div>t = WaterDipole(atoms)</div></blockquote>
<p>atoms must contain 3 Atoms, either as a list or an AtomGroup; the first one MUST be
the oxygen, the other two are the hydrogens. The vector is calculated as</p>
<blockquote>
<div>d = xO + (xH1 - xH2)/2</div></blockquote>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="distances.html" title="7.5. Fast distance array computation — MDAnalysis.core.distances"
             >next</a> |</li>
        <li class="right" >
          <a href="Selection.html" title="7.3. Atom selection Hierarchy — MDAnalysis.core.Selection"
             >previous</a> |</li>
        <li><a href="../../index.html">MDAnalysis v0.7.5-devel documentation</a> &raquo;</li>
          <li><a href="../core_modules.html" >7. Core modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2005-2011, Naveen Michaud-Agrawal, Elizabeth J. Denning, Joshua Adelman,
    Christian Beckstein (logo), David Caplan, Jan Domański, Philip Fowler,
    Joseph Goose, Benjamin Hall, Danny Parton, Tyler Reddy, Paul Rigor,
    and Oliver Beckstein.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>